﻿using System;

namespace YArchitech.MEP
{
	public class HYTubeAttachment
	{
		public HYComponent Object { get; set; }

		public string ShowName { get; set; }

		public double Value { get; set; }

		public bool IsTerminal { get; set; }

		public int PartIndex { get; set; }

		public void Save()
		{
			if (this.Object is HYTerminal)
			{
				(this.Object as HYTerminal).Resistance = this.Value;
				return;
			}
			if (this.Object is HYAccessory)
			{
				(this.Object as HYAccessory).Coefficient = this.Value;
				return;
			}
			if (this.Object is HYFitting)
			{
				(this.Object as HYFitting).SetCoeffient(this.Value, this.PartIndex);
			}
		}
	}
}
